package com.bootcamp.idea1125.controller;

import com.bootcamp.idea1125.bean.BaseRespVO;
import com.bootcamp.idea1125.bean.User;
import com.bootcamp.idea1125.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: springboot
 * @description:
 * @author: Keyu Li
 * @create: 2021-11-25 16:16
 **/

@RestController
public class HelloController {

    @Autowired
    UserService userService;
    @RequestMapping("hello1")
    public BaseRespVO hello1(){
        return BaseRespVO.ok("hello QQQQQAAAABoot");
    }

    @RequestMapping("query/{id}")
    public BaseRespVO queryById(@PathVariable("id") Integer id){
        User user = userService.queryById(id);
        return BaseRespVO.ok(user);
    }
}
